package com.chuanke.ckfamily.action.common;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.chuanke.ckfamily.action.base.Response;
import com.chuanke.ckfamily.dao.common.model.Help;
import com.chuanke.ckfamily.service.base.FailCode;
import com.chuanke.ckfamily.service.common.HelpService;

@Controller
@RequestMapping("/api/help")
public class HelpController {

	@Autowired
	private HelpService helpService;

	/**
	 * 帮助 /api/user/help
	 * 
	 * @param request
	 * @return
	 */
	@ResponseBody
	@RequestMapping("/help")
	public Response getHelp(HttpServletRequest request, @RequestParam("code") String code) {
		try {
			Help help = helpService.findByCode(code);
			return new Response(help);
		} catch (Exception e) {
			e.printStackTrace();
			return new Response(FailCode.APP, e.getMessage());
		}
	}
}
